﻿using Pay.DTO;
using Pay.IService;
using Pay.TO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Pay.Web.Areas.Admin.Controllers
{
    /// <summary>
    /// 用户升级
    /// </summary>
    [RouteArea("admin")]
    [RoutePrefix("tokenupgrade")]
    public class TokenUpGradeController : AdminController {
        private ITokenUpGradeService _iTokenUpGradeService;

        public TokenUpGradeController(ITokenUpGradeService iTokenUpGradeService) {
            _iTokenUpGradeService = iTokenUpGradeService;
        }
        [HttpGet]
        public JsonResult Gets(UpGradeQuery query) {
            var result = _iTokenUpGradeService.Gets(query);
            return Json(ResultToJson.Json(result), JsonRequestBehavior.AllowGet);
        }

        #region 用户通过微信支付升级创客
        [HttpGet]
        public JsonResult GetTokenUpGradeMakerPageList(TokenUpGradeMakerQuery query) {
            var result = _iTokenUpGradeService.GetTokenUpGradeMakerPageList(query);
            return Json(ResultToJson.Json(result), JsonRequestBehavior.AllowGet);
        }
        [HttpPost]
        public JsonResult SetTokenUpGradeMakerProcessed(long chargeId) {
            var result = _iTokenUpGradeService.SetTokenUpGradeMakerProcessed(chargeId);
            return Json(ResultToJson.Json(result ? " 设置成功" : "设置失败", result));
        }

        #endregion
    }
}
